package com.pang.songbo.songboexcel.util;

import java.io.IOException;
import java.util.*;

/**
 * @author Da.Pang
 * 2025/11/4 10:14
 */
public class ExcelMain {

    public static void main(String[] args) throws IOException {
        List<Map<String, Object>> maps = ExcelReader.readExcel("D:/丹-删减版.xlsx", 0);


        List<Map<String,Object>> result = new ArrayList<>();
        for (Map<String, Object> map : maps) {
            Map<String,Object> resultMap = new TreeMap<>();
            resultMap.putAll(map);
            for (Map.Entry<String, Object> entry : map.entrySet()) {
                if(entry.getKey() == null){
                    continue;
                }


                if(entry.getKey().contains("项目")){
                    if(entry.getValue() != null ){
                        String value = entry.getValue().toString();
                        String[] split = value.split("\\|");

                        for (int i = 0; i < split.length; i++) {
                            String newName = entry.getKey() + "-" + (i + 1);
                            resultMap.put(newName,split[i]);
                        }
                    }


                }
            }
            result.add(resultMap);
        }


        ExcelWriter.writeExcelWithMap("D:/666.xlsx","测试",result);

    }
}